﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8" />
    <title>考核规则</title>
    <script language="JavaScript" src="../../Comm/JScript.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <!-- 引用通用的js文件. -->
    <script type="text/javascript" src="../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../Comm/Gener.js"></script>
    <script type="text/javascript" language="javascript">
        //页面启动函数.
        $(function () {

            $("#Msg").html("正在加载,请稍后......");

            //初始化groupID.
            var nodeID = GetQueryString("FK_Node");

            //调用公共类库的方法.
            GenerBindEnumKey("DDL_TWay", "TWay", "1");


            //执行.
            var node = new Entity("BP.WF.Node", nodeID);

            var fk_flow = node.FK_Flow.replace(/^0+/, "")
            var FK_MapData = "ND" + fk_flow +"Rpt";

            var mapAttrs = new Entities("BP.Sys.MapAttrs");
            mapAttrs.Retrieve("FK_MapData", FK_MapData);
            //按照时间点的考核方式
            var CHWayOfTimeRole = node.GetPara("CHWayOfTimeRole");
            if (CHWayOfTimeRole == null || CHWayOfTimeRole == undefined || CHWayOfTimeRole == '') {
                $("input[name='RB_CHWayOfTimeRole'][value='0']").attr("checked", true);
            
            } else {
                $("input[name='RB_CHWayOfTimeRole'][value=" + CHWayOfTimeRole + "]").attr("checked", true);
            
            }
            //查询日期字段下拉框所有值
            for (var i = 0; i < mapAttrs.length; i++) {
                if (mapAttrs[i].MyDataType != 6 && mapAttrs[i].MyDataType != 7)
                    continue;
                if (mapAttrs[i].KeyOfEn == "RDT" || mapAttrs[i].KeyOfEn == "CDT" || mapAttrs[i].KeyOfEn == "FlowEnderRDT" || mapAttrs[i].KeyOfEn == "FlowStartRDT")
                    continue;
                $("#DDL_Fields").append("<option value=" + mapAttrs[i].KeyOfEn + ">" + mapAttrs[i].Name + "</option>");
            }
            //日期字段下拉框赋值
            var CHWayOfTimeRoleField = node.GetPara("CHWayOfTimeRoleField");
            if (CHWayOfTimeRoleField == null || CHWayOfTimeRoleField == undefined || CHWayOfTimeRoleField == '') {
                $("#DDL_Fields").val(0);
            } else {
                $("#DDL_Fields").val(CHWayOfTimeRoleField);
            }
            //调用公共类库的方法:执行批量主表赋值
            GenerFullAllCtrlsVal(node);

            //
            var str = $("#TB_TimeLimit").val();
            if (str == null || str == "")
                $("#TB_TimeLimit").val(0);

            str = $("#TBPara_TimeLimitHH").val();
            if (str == null || str == "")
                $("#TBPara_TimeLimitHH").val(0);


        });

        function Save() {

            var nodeID = GetQueryString("FK_Node");

            //执行查询.
            var node = new Entity("BP.WF.Node", nodeID);
            node.CopyForm(); //复制表单数据.

            var CHWayOfTimeRole = $('input:radio[name="RB_CHWayOfTimeRole"]:checked').val();
            node.SetPara("CHWayOfTimeRole", CHWayOfTimeRole); //时间点考核方式

            var CHWayOfTimeRoleField = $("#DDL_Fields").val();
            node.SetPara("CHWayOfTimeRoleField", CHWayOfTimeRoleField); //按表单字段的字段

            //节假日计算方式.
            node.TWay = $("#DDL_TWay").val(); //节假日考核方式.

            node.Update();

            Back();
        }
        function Back() {
            window.location.href = "CHRole.htm?FK_Node=" + GetQueryString("FK_Node"); 
        }
    </script>
</head>
<body>
    <form id="cc">
    <table style="width: 100%;">
        <caption> 设置按照时间点的考核方式</caption>
        <tr>
            <td>
                <fieldset>
                    <legend>
                        <input type="radio" value="0" id="RB_CHWayOfTimeRole_0" name="RB_CHWayOfTimeRole">
                        <label for="RB_CHWayOfTimeRole_0">按时效考核</label></legend>
                        <!-- *********************************8  按时效考核 &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&  -->
                        
                        
                    <table style="width: 100%;">
                        <tr>
                            <td nowarp="true">
                                限期完成时限：
                            </td>
                            <td>
                                <input type="text" id="TB_TimeLimit" name="TB_TimeLimit" style="width: 30px;" />天,
                            </td>
                            <td>
                                <input type="text" id="TBPara_TimeLimitHH" name="TBPara_TimeLimitHH" style="width: 30px;" />小时,
                            </td>
                            <!--<td style="color: Gray">
                                <input type="text" id="TBPara_TimeLimitMM" name="TBPara_TimeLimitMM" style="width: 30px;" />分钟
                            </td>-->
                        </tr>
                        <tr>
                            <td>
                                节假日
                            </td>
                            <td>
                                <select name="DDL_TWay" id="DDL_TWay">
                                </select>
                            </td>
                            <td >
                                <a href="javascript:WinOpen('../../Comm/Sys/Holiday.htm');">节假日维护</a>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4">
                                说明: WF_CH 这个表用于存储时效考核数据,您可以仔细研究该表的结构并做想用的考核数据的使用.
                            </td>
                        </tr>
                    </table>

                </fieldset>


                <fieldset>
                    <legend>
                        <input type="radio" value="1" id="RB_CHWayOfTimeRole_1" name="RB_CHWayOfTimeRole">
                        <label for="RB_CHWayOfTimeRole_1">
                            按表单的表单字段计算.
                        </label>
                    </legend>

                    
                    请选择日期字段: 
                    
                    <select id="DDL_Fields" >
                        <option value="0">请选择</option>
                    </select>

                    <ul>
                        <li style="color: Gray"> 选择表单中的日期时间字段来计算。</li>
                    </ul>
                </fieldset>
                <!--<fieldset>
                    <legend>
                        <input type="radio" value="2" id="RB_CHWayOfTimeRole_2" name="RB_CHWayOfTimeRole">
                        <label for="RB_CHWayOfTimeRole_2">
                            流转自定义.
                        </label>
                    </legend>
                    <ul style="color: Gray">
                        <li>启用流转自定义时间点考核，则按照流转自定义设置的时间来计算节点完成时间。</li>
                        
                    </ul>
                </fieldset>-->
               
                <input type="button" value="保存并返回" onclick="Save()" />
                <input type="button" value="返回" onclick="Back()" />

            </td>
        </tr>
    </table>
    </form>
</body>
</html>
